/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.persistencia.domain;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.Size;

/**
 *
 * @author SHERLY
 */
@Entity
@Table(name = "asignatura")
@NamedQueries({
    @NamedQuery(name = "Asignatura.findAll", query = "SELECT a FROM Asignatura a"),
    @NamedQuery(name = "Asignatura.findByNAsgId", query = "SELECT a FROM Asignatura a WHERE a.nAsgId = :nAsgId"),
    @NamedQuery(name = "Asignatura.findByNPlnCrrId", query = "SELECT a FROM Asignatura a WHERE a.nPlnCrrId = :nPlnCrrId"),    
    @NamedQuery(name = "Asignatura.findByNCicAcdId", query = "SELECT a FROM Asignatura a WHERE a.nCicAcdId = :nCicAcdId"),    
    @NamedQuery(name = "Asignatura.findByVCodigo", query = "SELECT a FROM Asignatura a WHERE a.vCodigo = :vCodigo"),
    @NamedQuery(name = "Asignatura.findByVNombre", query = "SELECT a FROM Asignatura a WHERE a.vNombre = :vNombre"),
    @NamedQuery(name = "Asignatura.findByNCreditos", query = "SELECT a FROM Asignatura a WHERE a.nCreditos = :nCreditos"),
    @NamedQuery(name = "Asignatura.findByVElectivo", query = "SELECT a FROM Asignatura a WHERE a.vElectivo = :vElectivo"),
    @NamedQuery(name = "Asignatura.findByVEstado", query = "SELECT a FROM Asignatura a WHERE a.vEstado = :vEstado")})
public class Asignatura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)   
    @Column(name = "nAsgId")
    private Integer nAsgId;
    @Size(max = 20)
    @Column(name = "vCodigo")
    private String vCodigo;
    @Size(max = 60)
    @Column(name = "vNombre")
    private String vNombre;
    @Column(name = "nCreditos")
    private Integer nCreditos;
    @Size(max = 1)
    @Column(name = "vElectivo")
    private String vElectivo;
    @Size(max = 1)
    @Column(name = "vEstado")
    private String vEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "asignatura")
    private List<Asignaturaprerequisito> asignaturaprerequisitoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "asignatura1")
    private List<Asignaturaprerequisito> asignaturaprerequisitoList1;
    @JoinColumn(name = "nCicAcdId", referencedColumnName = "nCicAcdId")
    @ManyToOne(optional = false)
    private Cicloacademico nCicAcdId;
    @JoinColumn(name = "nPlnCrrId", referencedColumnName = "nPlnCrrId")
    @ManyToOne(optional = false)
    private Plancurricular nPlnCrrId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "asignatura")
    private List<Asignaturaxperiodo> asignaturaxperiodoList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nAsgId")
    private List<Clase> claseList;

    public Asignatura() {
    }

    public Asignatura(Integer nAsgId) {
        this.nAsgId = nAsgId;
    }

    public Integer getNAsgId() {
        return nAsgId;
    }

    public void setNAsgId(Integer nAsgId) {
        this.nAsgId = nAsgId;
    }

    public String getVCodigo() {
        return vCodigo;
    }

    public void setVCodigo(String vCodigo) {
        this.vCodigo = vCodigo;
    }

    public String getVNombre() {
        return vNombre;
    }

    public void setVNombre(String vNombre) {
        this.vNombre = vNombre;
    }

    public Integer getNCreditos() {
        return nCreditos;
    }

    public void setNCreditos(Integer nCreditos) {
        this.nCreditos = nCreditos;
    }

    public String getVElectivo() {
        return vElectivo;
    }

    public void setVElectivo(String vElectivo) {
        this.vElectivo = vElectivo;
    }

    public String getVEstado() {
        return vEstado;
    }

    public void setVEstado(String vEstado) {
        this.vEstado = vEstado;
    }

    public List<Asignaturaprerequisito> getAsignaturaprerequisitoList() {
        return asignaturaprerequisitoList;
    }

    public void setAsignaturaprerequisitoList(List<Asignaturaprerequisito> asignaturaprerequisitoList) {
        this.asignaturaprerequisitoList = asignaturaprerequisitoList;
    }

    public List<Asignaturaprerequisito> getAsignaturaprerequisitoList1() {
        return asignaturaprerequisitoList1;
    }

    public void setAsignaturaprerequisitoList1(List<Asignaturaprerequisito> asignaturaprerequisitoList1) {
        this.asignaturaprerequisitoList1 = asignaturaprerequisitoList1;
    }

    public Cicloacademico getNCicAcdId() {
        return nCicAcdId;
    }

    public void setNCicAcdId(Cicloacademico nCicAcdId) {
        this.nCicAcdId = nCicAcdId;
    }

    public Plancurricular getNPlnCrrId() {
        return nPlnCrrId;
    }

    public void setNPlnCrrId(Plancurricular nPlnCrrId) {
        this.nPlnCrrId = nPlnCrrId;
    }
    
    public List<Asignaturaxperiodo> getAsignaturaxperiodoList() {
        return asignaturaxperiodoList;
    }

    public void setAsignaturaxperiodoList(List<Asignaturaxperiodo> asignaturaxperiodoList) {
        this.asignaturaxperiodoList = asignaturaxperiodoList;
    }

    public List<Clase> getClaseList() {
        return claseList;
    }

    public void setClaseList(List<Clase> claseList) {
        this.claseList = claseList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nAsgId != null ? nAsgId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Asignatura)) {
            return false;
        }
        Asignatura other = (Asignatura) object;
        if ((this.nAsgId == null && other.nAsgId != null) || (this.nAsgId != null && !this.nAsgId.equals(other.nAsgId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.persistencia.domain.Asignatura[ nAsgId=" + nAsgId + " ]";
    }
    
}
